import React, {useState} from 'react';
import {Button, Form, Input} from 'antd';

type LayoutType = Parameters<typeof Form>[0]['layout'];

const TableSearch = (props:any)=>{
     const [form] = Form.useForm();
    const [formLayout, setFormLayout] = useState<LayoutType>('inline');
    const {onSearch} = props
    return (
        <>
            <Form
                layout={formLayout}
                form={form}
                onFinish={onSearch}
                style={{ maxWidth: formLayout === 'inline' ? 'none' : 600 }}
            >
                <Form.Item name="username">
                    <Input placeholder="请输入名称" />
                </Form.Item>
                <Form.Item name="address">
                    <Input placeholder="请输入地址" />
                </Form.Item>
                <Form.Item name="email">
                    <Input placeholder="请输入邮箱" />
                </Form.Item>
                <Form.Item>
                    <Button type="primary" htmlType="submit">搜索</Button>
                </Form.Item>
            </Form>
        </>
    )
}


export default TableSearch